package com.example.Service;


import com.example.bean.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @Author: fxy
 * @Date: 2022/09/05/14:43
 * @Description:
 */
@Service("studentService")
@Lazy
public class StudentService {

	@Autowired
	private JdbcTemplate jdbcTemplate;
	@Transactional(rollbackFor = Exception.class)
	public void addStudent(Student student){
		System.out.println("add student:"+student);
		List<Map<String, Object>> maps = jdbcTemplate.queryForList("select * from good");
		System.out.println(maps);
	}

	@Transactional(rollbackFor = Exception.class)
	public void selectStudent(Student student){
		System.out.println("select student:"+student);
	}
}
